xenstored: add --priv-domid parameter
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>
Thu, 9 Feb 2012 18:33:36 +0000 (18:33 +0000)
committerDaniel De Graaf <dgdegra@tycho.nsa.gov>
Thu, 9 Feb 2012 18:33:36 +0000 (18:33 +0000)
This parameter identifies an alternative service domain which has
superuser access to the xenstore database, which is currently required
to set up a new domain's xenstore entries.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
tools/xenstore/xenstored_core.c
tools/xenstore/xenstored_core.h
tools/xenstore/xenstored_domain.c

index 66584f51d2b22403bbaf9fdd9d5f903dd2bea235..a42f55291d3e35b02ebd9fb03b1e05f965e3e965 100644 (file)
@@ -1752,6 +1752,7 @@ static struct option options[] = {
        { "event", 1, NULL, 'e' },
        { "help", 0, NULL, 'H' },
        { "no-fork", 0, NULL, 'N' },
+       { "priv-domid", 1, NULL, 'p' },
        { "output-pid", 0, NULL, 'P' },
        { "entry-size", 1, NULL, 'S' },
        { "trace-file", 1, NULL, 'T' },
@@ -1765,6 +1766,7 @@ static struct option options[] = {
 
 extern void dump_conn(struct connection *conn); 
 int dom0_event = 0;
+int priv_domid = 0;
 
 int main(int argc, char *argv[])
 {
@@ -1825,6 +1827,9 @@ int main(int argc, char *argv[])
                case 'e':
                        dom0_event = strtol(optarg, NULL, 10);
                        break;
+               case 'p':
+                       priv_domid = strtol(optarg, NULL, 10);
+                       break;
                }
        }
        if (optind != argc)
index e1c2be7a48302b5550f8365d26c0ed1596ce1198..92c27ba92f2ba72edc964877cb146ad0fcc10e7a 100644 (file)
@@ -169,6 +169,7 @@ void dtrace_io(const struct connection *conn, const struct buffered_data *data,
 
 extern int event_fd;
 extern int dom0_event;
+extern int priv_domid;
 
 /* Map the kernel's xenstore page. */
 void *xenbus_map(void);
index fa9c8fe984eb6be1e04ec16304a7a19724288053..f8c822f46e24561a2f60651170e395c45044dc89 100644 (file)
@@ -259,7 +259,7 @@ bool domain_can_read(struct connection *conn)
 
 bool domain_is_unprivileged(struct connection *conn)
 {
-       return (conn && conn->domain && conn->domain->domid != 0);
+       return (conn && conn->domain && conn->domain->domid != 0 && conn->domain->domid != priv_domid);
 }
 
 bool domain_can_write(struct connection *conn)